<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../org/angular.min.js"></script>
</head>

<body ng-app="app" ng-controller="ctrl">
    <div>
        商品： <input type="text" name="title" ng-model="goods.title">
    </div>
    <div>
        价格： <input type="text" name="title" ng-model="goods.price" readonly>
    </div>
    <div>
        数量： <input type="number" name="title" ng-model="goods.num">
    </div>
    <div>
        <!-- ng-value 后面可以写表达式 -->
        总价: <input type="text" name="" ng-value="goods.price*goods.num" readonly>
        <!-- 直接写value是无法处理angular的数据的，只能用angular的指令来处里 -->
        <input type="text" name="" value="goods.price*goods.num">
    </div>
    <script>
        var m = angular.module('app', []);
        m.controller('ctrl', ['$scope', function($scope) {
            $scope.goods = {
                title: '视频教程',
                price: 30,
                num: 1
            };
        }])
    </script>
</body>

</html>
